package com.itlaobing.binary;

import java.net.URLEncoder;
import java.nio.charset.Charset;

/**
 * 理解URL编码操作 : URLEncoder.encode( String , Charset )
 */
public class URLEncodeTest {

    public static void main(String[] args) {

        // final String url = "http://www.baidu.com/s?wd=张三丰" ;
        String url = "张三丰" ;
        System.out.println( url );

        Charset charset = Charset.forName( "UTF-8" );
        String encoded = URLEncoder.encode( url , charset );
        System.out.println( encoded );

    }

}

